package com.ymttest.database.sqlwapper.anlihui;

import java.util.HashMap;
import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.anlihui.SettlementDetail;

public class SettlementDetailWrapper {
	
	SqlManager manager;

    public SettlementDetailWrapper() {
        manager = new SqlManager("anlihui");
    }
    
    @SuppressWarnings("unchecked")
	public SettlementDetail selectByPrimaryKey(Long id) {
    	
    	SettlementDetail settlementDetail = new SettlementDetail();
    	List<SettlementDetail> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.anlihui.SettlementDetailMapper.selectByPrimaryKey",
                        id);
        manager.commit();
        
		if (result.size() > 0) {
			settlementDetail = result.get(0);
		}
		
        return settlementDetail;
    }
    
    @SuppressWarnings("unchecked")
	public SettlementDetail selectBySettlementIdAndCatalogId(String settlementId, String catalogId) {
    	
    	SettlementDetail settlementDetail = new SettlementDetail();
    	
    	HashMap<String, String> map = new HashMap<>();
    	
    	map.put("settlementId", settlementId);
    	map.put("catalogId", catalogId);
    	
    	List<SettlementDetail> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.anlihui.SettlementDetailMapper.selectBySettlementIdAndCatalogId",
                        map);
        manager.commit();
        
		if (result.size() > 0) {
			settlementDetail = result.get(0);
		}
		
        return settlementDetail;
    }
    
    public static void main(String[] args) {
    	
    	SettlementDetailWrapper test = new SettlementDetailWrapper();
    	System.out.println(test.selectByPrimaryKey(1L).getProduct_id());
    }
}
